package demo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;

public class W5_HashmapDeweight {
	public static void main(String[] args) {
		int[] arr1 = {1,2,3};
		int[] arr2 = {3,4,5,2};
		ArrayList<Integer> list = new ArrayList();
		Map<Integer, Integer> map =new HashMap();
		
		for(int key1:arr1){
			map.put(key1, 1);
		}
		for(int key2:arr2){
			if(map.containsKey(key2)){
				map.put(key2, -1);
			}else{
				map.put(key2, 1);
			}
		}
		
		Set<Entry<Integer, Integer>> entrySet = map.entrySet();
		for (Entry<Integer, Integer> entry : entrySet) {
			if(entry.getValue()==1){
				list.add(entry.getKey());
			}
		}
		System.out.println(list);
	}
}
